package com.javaee.term.service.iml;

import com.javaee.term.data.TurnOver;
import com.javaee.term.dto.ContactDetailDto;
import com.javaee.term.dto.ContactDto;
import com.javaee.term.model.Contact;
import com.javaee.term.model.ContactDetail;
import com.javaee.term.service.ContactService;
import com.javaee.term.service.base.BaseServiceIml;
import com.javaee.term.service.base.IBaseService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * author 陈伯瑞
 * date 2019/12/15 0015 21:32
 * version 1.0
 **/
@Service
public class ContactServiceIml extends BaseServiceIml implements ContactService {
    @Override
    public Contact findOne(Object id) {
        return contactMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Contact> findAll() {
        return contactMapper.selectAll();
    }

    @Override
    public void delete(Object id) {
        contactMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Contact contact) {
        return contactMapper.insert(contact);
    }

    @Override
    public int update(Contact contact) {
        return contactMapper.updateByPrimaryKey(contact);
    }

    @Override
    public List<Contact> findByPage(Map<String, Object> data) {

        return  contactMapper.selectBypage(data);
    }

    @Override
    public Integer findAllCount() {
        return contactMapper.selectAllCount();
    }

    @Override
    public List<ContactDto> findContactAndCustomer(Integer manId) {
        return contactMapper.selectContactAndCustomer(manId);
    }

    @Override
    public List<TurnOver> getTrunOverData() {
        return contactMapper.selectTrunOverData();
    }

    @Override
    public List<TurnOver> getTheSumEachMouth(String year) {
        return contactMapper.selectTheSumEachMouth(year);
    }

    @Override
    public List<TurnOver> getTheSumEachWeek(String year) {
        return contactMapper.selectTheSumEachWeek(year);
    }


}
